package com.apes.scm.masterdata.product.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 功能：商品计量单位类别
 *
 * @author xuliang
 * @create 2018-02-03 22:01
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = ProductUomCategory.CONST_TABLE_NAME)
public class ProductUomCategory extends Model {
    public static final String CONST_TABLE_NAME = "mas_product_uom_category";

    @Id
    @Column(name = "id", length = 12)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "商品计量单位类别")
    @Comment("编码")
    private String id;

    @Column(name = "name", nullable = false, length = 250)
    @Comment("名称")
    private String name; //名称

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "classify_id", referencedColumnName = "id")
    @Comment("分类编码")
    private Classify classify;  //分类编码

}
